package com.chang.soul.service.imp;

import com.chang.soul.bean.PaperBean;
import com.chang.soul.bean.PaperQueryForm;
import com.chang.soul.dao.PaperMapper;
import com.chang.soul.service.PaperService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class PaperServiceImp implements PaperService {

    @Autowired
    PaperMapper paperMapper;


    @Override
    public boolean insertPaper(PaperBean paperBean) {
        try {
            paperMapper.insertPaper(paperBean);
        }catch (Exception e){
            System.out.println(e);
            return false;
        }
        return true;
    }

    @Override
    public Integer getPaperCount() {
        return paperMapper.getPaperCount();
    }

    @Override
    public List<PaperBean> getAllPaperList(PaperQueryForm paperQueryForm) {
        return paperMapper.getAllPaperList(paperQueryForm);
    }

    @Override
    public Integer getCountByPaperList(PaperQueryForm paperQueryForm) {
        return paperMapper.getCountByPaperList(paperQueryForm);
    }

    @Override
    public PaperBean getPaperById(Integer id) {
        return paperMapper.getPaperById(id);
    }

    @Override
    public boolean deletePaperById(Integer id) {
        return paperMapper.deletePaperById(id);
    }

    @Override
    public boolean updatePaper(PaperBean paperBean) {
        return paperMapper.updatePaper(paperBean);
    }

    @Override
    public List<PaperBean> getPapersByPapId(Integer paperId) {
        return paperMapper.getPapersByPapId(paperId);
    }
}
